package com.fs.service;

import com.fs.dao.DbInfoDao;
import com.fs.domain.DbInfo;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by fengshuai on 17/5/18.
 */
@Service
public class DbInfoService {
    protected static Logger logger = Logger.getLogger(DbInfoService.class);

    @Autowired
    private DbInfoDao dbInfoDao;

    public Map<Integer, DbInfo> getAllMap() {
        Map<Integer, DbInfo> map = new HashMap<>();
        List<DbInfo> list = this.dbInfoDao.getAll();
        for (DbInfo dbInfo : list) {
            map.put(dbInfo.getId(), dbInfo);
        }
        return map;
    }

    public List<DbInfo> getAllList() {
         return this.dbInfoDao.getAll();
    }

}
